<template>
	<view @click="openlocation" class="navgtion">
		<u-icon name="map-fill" size="22" color="#45bc1b"></u-icon></u-icon>
		<text>{{$t('Navigation')}}</text>
	</view>
</template>

<script>
	var jweixin = require('jweixin-module');
	import jwx from '@/utils/jwx.js'
	export default {
		props: ['location','name','address'],
		data() {
			return {
				
			}
		},
		methods: {
			openlocation() {
				let that = this;
				let url = window.location.href;
				jwx.initJssdk(url);
				jweixin.ready(function() {
					jweixin.openLocation({
						latitude: that.location[0], // 纬度，浮点数，范围为90 ~ -90
						longitude: that.location[1], // 经度，浮点数，范围为180 ~ -180。
						name: that.name, // 位置名
						address: that.address, // 地址详情说明
						scale: 15, // 地图缩放级别,整形值,范围从1~28。默认为最大
						success(res) {
							console.log('成功了吗', res)
						},
					});
				})
			},
		},
	}
</script>
<style lang="scss" scoped>
	.navgtion {
		width: 100%;
		display: flex;
		align-items: center;
		color: $uni-color-topic;
		// padding: 10rpx 5rpx;
	}
</style>